package com.nbsaas.boot.express.rest.resource;

import com.nbsaas.boot.express.api.apis.ExpressApi;
import com.nbsaas.boot.express.data.entity.Express;
import com.nbsaas.boot.express.api.domain.request.ExpressRequest;
import com.nbsaas.boot.express.api.domain.response.ExpressResponse;
import com.nbsaas.boot.express.api.domain.simple.ExpressSimple;
import com.nbsaas.boot.express.rest.convert.ExpressSimpleConvert;
import com.nbsaas.boot.express.rest.convert.ExpressEntityConvert;
import com.nbsaas.boot.express.rest.convert.ExpressResponseConvert;
import com.nbsaas.boot.express.data.repository.ExpressRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   快递公司-业务接口实现
*/
@Transactional
@Service
public class ExpressResource extends BaseResource<Express,ExpressResponse, ExpressSimple, ExpressRequest>  implements ExpressApi {

    @Resource
    private ExpressRepository expressRepository;

    @Override
    public JpaRepositoryImplementation<Express, Serializable> getJpaRepository() {
        return expressRepository;
    }

    @Override
    public Function<Express, ExpressSimple> getConvertSimple() {
        return new ExpressSimpleConvert();
    }

    @Override
    public Function<ExpressRequest, Express> getConvertForm() {
        return new ExpressEntityConvert();
    }

    @Override
    public Function<Express, ExpressResponse> getConvertResponse() {
        return new ExpressResponseConvert();
    }




}


